package com.geostar.constructionland.statistics.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.geostar.constructionland.common.entity.response.ExtJsAjaxResponse;
import com.geostar.constructionland.common.entity.statistics.LogStatistics;
import com.geostar.constructionland.statistics.service.LogStaticService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * @author zhu jiacheng
 * @date 2020/7/27 19:35
 */
@Api("执行记录控制器")
@RestController
@RequestMapping(path = "/logStatistics")
@Slf4j
@Validated
public class LogStatisticsController {
    @Autowired
    private LogStaticService logStaticService;

    /**
     * 分页查询
     *
     * @param pageNo
     * @param pageNum
     * @return
     */
    @PostMapping(path = "/list")
    public ExtJsAjaxResponse list(
            @NotNull(message = "页码不能为空") @RequestParam(value = "page") int pageNo,
            @NotNull(message = "每页数量不能为空") @RequestParam(value = "limit") int pageNum,
            String query_fxlx) {
        IPage<LogStatistics> analyseVersionIPage
                = logStaticService.getLogStatisticsForPage(pageNo, pageNum, query_fxlx);
        return ExtJsAjaxResponse.createBySuccess(analyseVersionIPage);
    }
}
